package com.example.databinding_demo.mvvm;

import com.example.databinding_demo.MCallback;
import com.example.databinding_demo.User;

import java.util.Random;

public class MvvmModel {

    public void getAccountData(String accountName, MCallback<User> callback){
        Random random = new Random();
        boolean isSuccess = random.nextBoolean();
        if(isSuccess){
            User user = new User();
            user.setUsername(accountName);
            user.setPwd(100);
            callback.onSuccess(user);
        }else{
            callback.onFailed();
        }
    }
}
